#include <iostream>
#include <vector>
using namespace std;

const int NMAX = 100;

vector<int> a[NMAX];
vector<int> b[NMAX];
int n;
int vis[100];
int cnt;
int s,t;

void init()
{ int m;
  cin >> n >> m;
  
  for(int i=0; i<m; i++)
  { int u,v;
    cin >> u >> v;
    a[u].push_back(v);
    b[v].push_back(u);
  }
}

void dfs(int u)
{ vis[u]=1;
  cout << u << " ";
  cnt++;
  int k=a[u].size();
  for(int i=0; i<k; i++)
  { int v = a[u][i];
    if(vis[v]==0)
      dfs(v);
  }
  
}

void dfsR(int u)
{ vis[u]=1;
  cout << u << " ";
  cnt++;
  int k=b[u].size();
  for(int i=0; i<k; i++)
  { int v = b[u][i];
    if(vis[v]==0)
      dfsR(v);
  }
  
}

int main()
{ init();
  
  cnt=0; 
  for(int u=1; u<=n; u++)
    vis[u]=0;
  dfs(5);
  cout << endl;
  int k=cnt;
  
  cnt=0;
  for(int u=1; u<=n; u++)
    vis[u]=0;
  dfsR(5);
  cout << endl;
  int kR=cnt;
  
  if(k==n && kR==n) 
    cout << "Strongly connected" << endl;
  else
    cout << "Sorry" << endl;  
  
  cout << endl;               
  return 0;
}
